package ch.ethz.fcl.draw;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class Circle extends View {
	public float x;
	public float y;
	public int radius;
	public Paint mpaint = new Paint(Paint.ANTI_ALIAS_FLAG);

	public Circle(Context context, float x, float y, int radius) {
		super(context);
		mpaint.setColor(Color.BLUE);
		this.x = x;
		this.y = y;
		this.radius = radius;
	}

	public void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		canvas.drawCircle(x, y, radius, mpaint);
	}

	public void compress() {
		if (radius > 5)
			radius -= 5;
	}

	public void extend() {
		radius += 5;
	}

	public String info() {
		float radius = Bounds.getBoundX(this.radius * 1.0f) * 2;
		System.out.println(Bounds.getBoundX(this.radius * 1.0f) + ":"
				+ Bounds.getBoundY(this.radius * 1.0f));
		return Bounds.getBoundX(x) + ":" + Bounds.getBoundY(y) + ":" + radius;
	}
}
